#include <iostream>
#include <unordered_set>
#include <string>
#include<algorithm>

using namespace std;

int main(){
    string s1, s2;
    std::getline(cin, s1);
    cin >> s2;
    std::unordered_set<char> schar;
    for (auto& ch : s2) schar.insert(ch);
    for (auto& x : s1){
        if (schar.count(x)) continue;
        cout << x;
    }
    return 0;
}